%define commit a60ebe9a340c52ae9d7ccbb56011a0ac8a3f26d8
%define commit_short %(echo %{commit} | head -c6)

%define service dbus-app-store-service
Summary(ru_RU.UTF-8):	Демон магазина приложений для МОС
Summary:	Applications store service MOS
Name:		mos-appstore-service
Version:	1.0
Release:	4.git%{commit_short}.2
License:	GPL
Group:		System/Configuration/Packaging
Url:		https://os.mos.ru/
Vendor:		MOS
Source0:	https://hub.mos.ru/mos/src/uds-agent2/dbus-app-store-service/-/archive/%{commit}/%{service}-%{commit}.tar.gz

BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: glibc-devel
BuildRequires: pkgconfig(sdbus-c++)

%description
%summary.

%description -l ru_RU.UTF-8
Демон для клиента магазина приложений МОС.

%files
%{_sbindir}/%{service}
%{_datadir}/dbus-1/system-services/org.mos.appstore.service
%{_datadir}/dbus-1/system.d/org.mos.appstore.conf
%{_sysconfdir}/mos-appstore/pub.key

#------------------------------------------------------------------

%prep
%autosetup -p1 -n %{service}-%{commit}

%build
%cmake
%make

%install
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
mkdir -p %{buildroot}%{_datadir}/dbus-1/system.d
mkdir -p %{buildroot}%{_sysconfdir}/mos-appstore

install -p -m750 build/%{service} %{buildroot}%{_sbindir}
install -m644 org.mos.appstore.service %{buildroot}%{_datadir}/dbus-1/system-services
install -m644 org.mos.appstore.conf %{buildroot}%{_datadir}/dbus-1/system.d
install -m644 pub.key %{buildroot}%{_sysconfdir}/mos-appstore
